# 猜拳，需求：参与游戏的角色有两个（玩家 与 电脑），玩家手工出拳，电脑随机出拳，根据石头剪刀布判断输赢。大致有三种情况：
import random


def get_computer_choice():
    # 电脑随机出拳
    choices = ["石头", "剪刀", "布"]
    return random.choice(choices)


def get_player_choice():
    # 玩家手工出拳
    while True:
        player_choice = input("请输入你的选择（石头、剪刀、布）：")
        if player_choice in ["石头", "剪刀", "布"]:
            return player_choice
        else:
            print("输入无效，请重新输入！")


def determine_winner(player_choice, computer_choice):
    # 判断输赢
    if player_choice == computer_choice:
        return "平局"
    elif (player_choice == "石头" and computer_choice == "剪刀") or \
            (player_choice == "剪刀" and computer_choice == "布") or \
            (player_choice == "布" and computer_choice == "石头"):
        return "玩家赢"
    else:
        return "电脑赢"


def main():
    print("欢迎来到石头、剪刀、布游戏！")
    player_choice = get_player_choice()
    computer_choice = get_computer_choice()

    print(f"玩家出：{player_choice}")
    print(f"电脑出：{computer_choice}")

    result = determine_winner(player_choice, computer_choice)
    print(f"结果：{result}")


if __name__ == "__main__":
    main()